<template>
    <div>
        <a-button type="primary" @click="showModal">Open Modal</a-button>
        <a-modal v-model:open="open" title="测试" @ok="handleOk">
            <p>Some contents...</p>
            <p>Some contents...</p>
            <p>Some contents...</p>
        </a-modal>
    </div>
</template>

<script>
import {FormDialog} from "@formily/antdv";
import {Button} from "ant-design-vue";
import DialogForm from "./Test.tsx";

// 弹框表单组件

export default {
    components: {Button},
    data() {
        return {};
    },
    methods: {
        handleOpen() {
            FormDialog("弹框表单", DialogForm)
                .forOpen((payload, next) => {
                    next({
                        initialValues: {
                            aaa: "123",
                        },
                    });
                })
                .forConfirm((payload, next) => {
                    console.log(payload);
                    next(payload);
                })
                .forCancel((payload, next) => {
                    console.log(payload);
                    next(payload);
                })
                .open()
                .then(console.log)
                .catch(console.error);
        },
    },
};
</script>
